import request from '@/utils/request'

// 获取列表
export function getDirectorysList(prarms?: {
  pageSize?: number
  page?: number
  state?: 0 | 1
  subjectID?: string
  directoryName?: string
}) {
  return request({
    url: '/directorys',
    params: prarms
  })
}
// 删除
export function delDirectorysList(id: string) {
  return request({
    url: `/directorys/${id}`,
    method: 'DELETE'
  })
}
// 获取简单列表
export function getDirectorysSimple() {
  return request({
    url: `/directorys/simple`
  })
}
// 获取简单列表
export function DirectorysSimple(id: string) {
  return request({
    url: `/directorys/${id}`
  })
}
// 添加
export function addDirectorysSimple(data: {
  subjectID: string
  directoryName: string
}) {
  return request({
    url: `/directorys`,
    method: 'post',
    data
  })
}
// 改变状态
export function change(data: { id: number; state: number }) {
  return request({
    url: `/directorys/${data.id}/${data.state}`,
    method: 'post',
    data
  })
}
// 修改
export function editDirectorys(data: {
  id: string
  subjectID: string
  directoryName: string
}) {
  return request({
    url: `/directorys/${data.id}`,
    method: 'PUT',
    data: data
  })
}
